RECOV=../../../../bin/recov-re
RECOV_INS=../../../../bin/recov-ins
NUM=../../../scripts/find_nums.pl

# series of recovering
itr=`cat ../now-itr.var`
copyopt=`cat ../../info/copyopt.var`
symm=`cat ../../info/symm.var`
lang=`cat ../../info/lang.var`
wa_gold=`cat ../../info/wa-gold.var`
num_train=`cat ../../info/num-train.var`
let line_giza_train=num_train*3

echo ${line_giza_train}
echo ${wa_gold}

exit;


if [ ${LANG} == ek ] ; then
	WAEVAL=`cat ../../info/num-eval2.var`
	let WAEVAL_GIZA=WAEVAL*3
	INFO_FN=src-eval2.rinfo
fi

if [ ${LANG} == ck ] ; then
	WAEVAL=`cat ../../info/num-eval.var`
	let WAEVAL_GIZA=WAEVAL*3
	INFO_FN=src-eval.rinfo
fi

if [ ${LANG} == ec ] ; then
	WAEVAL=`cat ../../info/num-eval.var`
	let WAEVAL_GIZA=WAEVAL*3
	INFO_FN=src-eval.rinfo
fi

if [ ${LANG} == ce ] ; then
	WAEVAL=`cat ../../info/num-eval.var`
	let WAEVAL_GIZA=WAEVAL*3
	INFO_FN=src-eval.rinfo
fi

if [ ${LANG} == ef ] ; then
	WAEVAL=`cat ../../info/num-eval.var`
	let WAEVAL_GIZA=WAEVAL*3
	INFO_FN=src-eval.rinfo
fi
########
rm -rf wa-evalwa-recov.*


########
if [ ${ITR} == 0 ]; then

	echo "i0"
	TMP_OUT=wa-evalwa.giza; head -${WAEVAL_GIZA}  wa-all.giza > ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-evalwa.nao ; head -${WAEVAL}       wa-all.nao  > ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-evalwa-recov.giza; ln -s `pwd`/wa-evalwa.giza ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-evalwa-recov.nao ; ln -s `pwd`/wa-evalwa.nao  ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-train.giza;  tail -n ${TRAIN_GIZA}    wa-all.giza > ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-train.nao ;  tail -n ${TRAIN}         wa-all.nao  > ${TMP_OUT}; echo ${TMP_OUT}
	exit

else

	TMP_OUT=wa-evalwa.giza; head -${WAEVAL_GIZA}  wa-all.giza > ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-evalwa.nao ; head -${WAEVAL}       wa-all.nao  > ${TMP_OUT}; echo ${TMP_OUT}
	#recov
	cp wa-evalwa.giza tmp-recov
	for(( i=${ITR}; i>0; i-- )); do
		let p=$i-1
		${RECOV} tmp-recov ../../i${p}/copycat/${INFO_FN} tmp-recov2
		mv tmp-recov2 tmp-recov
		rm -rf tmp-info
	done
	mv tmp-recov wa-evalwa-recov.giza
	perl ${NUM} -1 wa-evalwa-recov.giza > wa-evalwa-recov.nao

	TMP_OUT=wa-train.giza;  tail -n ${TRAIN_GIZA}    wa-all.giza > ${TMP_OUT}; echo ${TMP_OUT}
	TMP_OUT=wa-train.nao ;  tail -n ${TRAIN}         wa-all.nao  > ${TMP_OUT}; echo ${TMP_OUT}

fi

